<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2008 XBRL International. All Rights Reserved. -->
<?xml-stylesheet type="text/xsl" href="../stylesheets/conformanceFunction.xsl"?>
<testcase
  xmlns="http://xbrl.org/2008/conformance"
  xmlns:reg="http://xbrl.org/2008/registry"
  xmlns:fcn="http://xbrl.org/2008/function"
  xmlns:cfcn="http://xbrl.org/2008/conformance/function"
  xmlns:xbrli="http://www.xbrl.org/2003/instance"
  xmlns:xhtml="http://www.w3.org/1999/xhtml"
  xmlns:xfi="http://www.xbrl.org/2008/function/instance"
  xmlns:xfie="http://www.xbrl.org/2008/function/instance/error"
  xmlns:xqt-err="http://www.w3.org/2005/xqt-errors"
  xmlns:c="http://xbrl.org/formula/conformance/example" 
  xmlns:xlink="http://www.w3.org/1999/xlink"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xsi:schemaLocation="
  http://xbrl.org/2008/registry ../schemas/registry.xsd
  http://xbrl.org/2008/function ../schemas/function.xsd
  http://xbrl.org/2008/conformance ../schemas/conformance.xsd
  http://xbrl.org/2008/conformance/function ../schemas/conformanceFunction.xsd
  ">
  <owners>
    <reg:owner id="herm">
      <reg:name>Herm Fischer</reg:name>
      <reg:affiliation>UBMatrix / Mark V Systems</reg:affiliation>
      <reg:email>fischer@markv.com</reg:email>
     <reg:assumedOwnership moment="2008-02-19T00:00:00" />
    </reg:owner>
  </owners>

  <number>80207</number>

  <name>Function test xfi:v-equal-set</name>

  <documentation>
    <xhtml:p>
      Tests of function xfi:v-equal-set($left as node()*, $right as node()*) as xs:boolean
      </xhtml:p>
  </documentation>

  <reference xlink:type="simple" xlink:href="http://www.xbrl.org/Specification/XF-PWD-2006-12-07.htm#_Toc152670709"/>

  <variation id="V-01">
    <name>Returns v-equality of numeric items equal within precision and units</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
    </documentation>

    <inputs>
      <schema xlink:type="simple" xlink:href="value-test-concepts.xsd"/>
      <instance readMeFirst="true" id="V01" xlink:type="simple" xlink:href="value-test-instance.xml"/>
      <cfcn:call file="V01">
         xfi:v-equal-set( (//c:a[@id eq 't1'],//c:b[@id eq 't14']),
                          (//c:b[@id eq 't15'],//c:a[@id eq 't2']) )
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         $result instance of xs:boolean and 
         count( $result ) eq 1 and
         $result eq true()
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-02">
    <name>Same as V-01 but numeric items not v-equal-set</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
    </documentation>
    <inputs>
      <schema xlink:type="simple" xlink:href="value-test-concepts.xsd"/>
      <instance readMeFirst="true" id="V02" xlink:type="simple" xlink:href="value-test-instance.xml"/>
      <cfcn:call file="V02">
         xfi:v-equal-set( (//c:a[@id eq 't1'],//c:b[@id eq 't14']),
                          (//c:b[@id eq 't15'],//c:a[@id eq 't3'] ))
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         $result instance of xs:boolean and 
         count( $result ) eq 1 and
         $result eq false()
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-03">
    <name>Same as V-01 but arguments are sequences</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
    </documentation>
    <inputs>
      <schema xlink:type="simple" xlink:href="value-test-concepts.xsd"/>
      <instance readMeFirst="true" id="V03" xlink:type="simple" xlink:href="value-test-instance.xml"/>
      <cfcn:call file="V03">
         xfi:v-equal-set( ( //c:a[@id eq 't1'], //c:a[@id eq 't4']),
                      ( //c:a[@id eq 't2'], //c:a[@id eq 't5']) )
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         $result instance of xs:boolean and 
         count( $result ) eq 1 and
         $result eq true()
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-04">
    <name>Same as V-01 but arguments are sequences not same length</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
    </documentation>
    <inputs>
      <schema xlink:type="simple" xlink:href="value-test-concepts.xsd"/>
      <instance readMeFirst="true" id="V04" xlink:type="simple" xlink:href="value-test-instance.xml"/>
      <cfcn:call file="V04">
         xfi:v-equal-set( ( //c:a[@id eq 't1'], //c:a[@id eq 't4']),
                      ( //c:a[@id eq 't2'] ) )
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         $result instance of xs:boolean and 
         count( $result ) eq 1 and
         $result eq false()
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-05">
    <name>Not a node argument to function</name>
    <documentation>
      <xhtml:p>
        XPath-defined error for node type incorrect.
      </xhtml:p>
    </documentation>
    <inputs>
      <schema xlink:type="simple" xlink:href="value-test-concepts.xsd"/>
      <instance readMeFirst="true" id="V05" xlink:type="simple" xlink:href="value-test-instance.xml"/>
      <cfcn:call file="V05">
         xfi:v-equal-set( (/xbrli:xbrl/c:b[@id eq 't14']), ('foo') )
      </cfcn:call>
    </inputs>
    <outputs>
      <error>xqt-err:XPTY0004</error>
    </outputs>
  </variation>  

  <variation id="V-06">
    <name>A sequence of concepts as argument</name>
    <documentation>
      <xhtml:p>
        XPath-defined error for node type incorrect arity of arguments.
      </xhtml:p>
    </documentation>
    <inputs>
      <schema xlink:type="simple" xlink:href="value-test-concepts.xsd"/>
      <instance readMeFirst="true" id="V06" xlink:type="simple" xlink:href="value-test-instance.xml"/>
      <cfcn:call file="V06">
         xfi:v-equal-set( //c:a[starts-with(@id,'t')] )
      </cfcn:call>
    </inputs>
    <outputs>
      <error>xqt-err:XPST0017</error>
    </outputs>
  </variation>

  <variation id="V-07">
    <name>Wrong node to function</name>
    <documentation>
      <xhtml:p>
        Functions spec error for non-item node type.
      </xhtml:p>
    </documentation>
    <inputs>
      <schema xlink:type="simple" xlink:href="value-test-concepts.xsd"/>
      <instance readMeFirst="true" id="V07" xlink:type="simple" xlink:href="value-test-instance.xml"/>
      <cfcn:call file="V07">
         xfi:v-equal-set( /xbrli:xbrl/c:a[@id eq 't1'], 
                      /xbrli:xbrl/c:t[@id eq 't17'] )
      </cfcn:call>
    </inputs>
    <outputs>
      <error>xfie:NodeIsNotXbrlItem</error>
    </outputs>
  </variation>  

  <revisions>
    <reg:revision on="2008-02-19T00:00:00" by="herm">
      <xhtml:p>
        Created the test case.
      </xhtml:p>
    </reg:revision>
    <reg:revision on="2010-12-21T00:00:00" by="herm">
      <xhtml:p>
        Fixed typos per IHR 2010-12-21.
      </xhtml:p>
    </reg:revision>
  </revisions>

</testcase>
